import HelloWorld from "./components/HelloWorld";
import Button from "./components/button";
const { ButtonGroup } = Button;
import Breadcrumb from "./components/breadcrumb";
const { BreadcrumbItem } = Breadcrumb;
import { Row, Colx } from "./components/grid";
import Navbar from "./components/navbar";
const { NavbarItem, SubNavbar } = Navbar;
const { SubNavbarItem } = SubNavbar;
import Badge from "./components/badge";
import { Tabs, TabTitle, TabTitleItem, TabContent, TabContentItem } from "./components/tabs";
import Icon from "./components/icon";
import Layout from "./components/layout";
const { Header, Silder, Content, Footer } = Layout;
import Card from "./components/card";
const { CardHeader, CardBody } = Card;
import Table from './components/table';
import Carousel from './components/carousel';
import Progress from './components/progress';
import Collapse from './components/collapse';
const { CollapseItem } = Collapse;
import Input from './components/input';
import Select from './components/select';
const { Optgroup, Option } = Select;

import Layer from "./components/layer";

const components = {
  HelloWorld,
  Button,
  ButtonGroup,
  Row,
  Colx,
  Breadcrumb,
  BreadcrumbItem,
  Navbar,
  NavbarItem,
  SubNavbar,
  SubNavbarItem,
  Badge,
  Tabs,
  TabTitle,
  TabTitleItem,
  TabContent,
  TabContentItem,
  Icon,
  Layout,
  Header,
  Content,
  Footer,
  Silder,
  Card,
  CardHeader,
  CardBody,
  Table,
  Carousel,
  Progress,
  Collapse,
  CollapseItem,
  Input,
  Select,
  Optgroup,
  Option
};

const install = (Vue, opts = {}) => {
  if (install.installed)
    return;

  Object.keys(components).forEach(key => {
    Vue.component(key, components[key]);
  });

  Vue.prototype.$layer = Layer;
};

// auto install
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue);
}

const API = {
  ...components,
  install,
  version: '1.0.0'
}

export default API;